<template>
    <div class="item" @contextmenu.prevent="rightClick">
      <i class="el-icon-office-building"></i>
      <p v-if="!isShow">{{items.repoName}}</p>
      <el-input type="text"
                v-model="items.repoName"
                size="small"
                v-if="isShow"
                @blur="handleBlur(items)"></el-input>
    </div>
</template>

<script>
export default {
  name: 'listItem',
  props: {
    item: {
      type: Object,
      default: () => ({})
    }
  },
  data () {
    return {
      isShow: false
    }
  },
  computed: {
    items () {
      return this.item
    }
  },
  methods: {
    rightClick () {
      this.isShow = true
    },
    handleBlur (item) {
      this.isShow = false
      this.$emit('change', item)
    }
  }
}
</script>

<style lang="scss" scoped>
.item{
  i {
    font-size: 108px;
  }

  p {
    font-size: 14px;
    color: #999;
    height: 38px;
    overflow: hidden;
  }
}
</style>
